import { wait } from "@/utils/await";

export default {
  namespace: "dashboard",
  state: {},
  effects: {
    *getDashboardData({ payload }, { call, put, select }) {
      //   const { data } = yield call(queryUser, payload);
      yield wait();
      const data = {
        count: [
          {
            title: "总人数",
            value: 20,
            width: "100%",
          },
          {
            title: "入职一年内的员工",
            value: 18,
            width: "33%",
          },
          {
            title: "入职1-2年内的员工",
            value: 0,
            width: "33%",
          },
          {
            title: "入职4年内的员工",
            value: 4,
            width: "33%",
          },
        ],
        table: {
          title: "工作最老10人",
          width: "w-1/2",
          list: [
            { name: "李冠以", partment: "事业1部" },
            { name: "wds", partment: "事业1部" },
            { name: "lzhon", partment: "事业2部" },
            { name: "李冠以", partment: "事业1部" },
            { name: "zxc", partment: "" },
            { name: "李冠以", partment: "事业1部" },
            { name: "zxc", partment: "事业1部" },
            { name: "zxc", partment: "总部" },
          ],
        },
      };

      yield put({ type: "setData", payload: data });
    },
  },

  reducers: {
    setData(state, { payload }) {
      return {
        ...state,
        dashboard: payload,
      };
    },
  },
};
